import { Request, Response } from 'express';

function queryAllDepts(req: Request, res: Response) {
    const datas = [
        {
            key: 1,
            name: '中原金控',
            children: [
                {
                    title: '研发部',
                    key: 11,
                },
                {
                    title: '人事',
                    key: 12,
                },
                {
                    key: 13,
                    title: '财务部',
                },
            ],
        },
        {
            key: 2,
            title: '车来顺',
            children: [
                {
                    key: 21,
                    title: '研发部',
                },
                {
                    key: 22,
                    title: '人事',
                },
                {
                    key: 23,
                    title: '财务部',
                },
            ],
        },
    ]
    return res.json({ datas });
}

// 代码中会兼容本地 service mock 以及部署站点的静态数据
export default {
    'GET  /api/depts': queryAllDepts,
};
